Skip to content

Resizable: size and position properties can be modifed in resize event #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

scottgonzalez
Copy link
Member

Fixes gh-220

</property>
</argument>
<example>
<desc>Constrain horizontal resizing:</desc>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does the same thing as maxWidth, which isn't that great as an example. Here's a callback that I've been using in an application, restricting the resizable to a vertical grid of 30px:

resize: function(event, ui) {
    ui.size.height -= ui.size.height % 30;
    ui.size.height += ui.originalPosition.top % 30;
}

Maybe add this in addition to the current example?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a feeling the complexity of what's actually happening there might trip up users who are reading through the docs. Perhaps something simpler, like just throttling size and assuming the top/left is already on the grid?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that's what you already have. Could add my example in addition to this one - if you think that is still too distracting, leave it as-is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant something like ui.size.height = Math.round( ui.size.height / 30 ) * 30; to get the grid like snapping.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, that looks good.

@scottgonzalez
Copy link
Member Author

Updated the example.

@jzaefferer
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Resizable: Ability to update size and position in resize event
3 participants